package com.five.years.common.utils;

import at.favre.lib.crypto.bcrypt.BCrypt;

/**
 * @author : qinhuajun
 * @Date :2020-06-17
 */
public class HashUtil {

    public static String encryption(String password) {
        String hash = BCrypt.with(BCrypt.Version.VERSION_2Y).hashToString(12, password.toCharArray());
        return hash;
    }

    public static Boolean verify(String password, String passwordFromData) {
        return BCrypt.verifyer().verify(password.toCharArray(), passwordFromData).verified;
    }

}
